package com.cuitrip.business.order.detail.ui.present;

import com.cuitrip.business.order.detail.orderstatus.BaseOrderFormPresent;
import com.cuitrip.business.order.detail.orderstatus.traveller.TravellerOtherPresent;
import com.cuitrip.business.order.detail.orderstatus.traveller.TravellerOverPresent;
import com.cuitrip.business.order.detail.orderstatus.traveller.TravellerRefundPresent;
import com.cuitrip.business.order.detail.orderstatus.traveller.TravellerUnvaliablePresent;
import com.cuitrip.business.order.detail.orderstatus.traveller.TravellerWaitCommentPresent;
import com.cuitrip.business.order.detail.orderstatus.traveller.TravellerWaitConfirmPresent;
import com.cuitrip.business.order.detail.orderstatus.traveller.TravellerWaitEndPresent;
import com.cuitrip.business.order.detail.orderstatus.traveller.TravellerWaitPayPresent;
import com.cuitrip.business.order.detail.orderstatus.traveller.TravellerWaitStartPresent;
import com.cuitrip.business.order.detail.ui.ITravelerOrderDetailView;
import com.cuitrip.business.order.model.OrderItem;

/**
 * Created by ak on 15/12/17.
 */
public class TravelProxyPresent extends IProxyPresent<ITravelerOrderDetailView> {

    BaseOrderFormPresent baseOrderFormPresent;

    public TravelProxyPresent(ITravelerOrderDetailView orderDetailView) {
        super(orderDetailView);
    }

    public void changeOrderItem(OrderItem orderItem) {
        setOrderItem(orderItem);
        switch (orderItem.getStatus()) {
            case OrderItem.STATUS_WAIT_CONFIRM:
                baseOrderFormPresent = new TravellerWaitConfirmPresent(mOrderDetailView, orderItem);
                break;
            case OrderItem.STATUS_WAIT_PAY:
                baseOrderFormPresent = new TravellerWaitPayPresent(mOrderDetailView, orderItem);
                break;
            case OrderItem.STATUS_WAIT_START:
                baseOrderFormPresent = new TravellerWaitStartPresent(mOrderDetailView, orderItem);
                break;
            case OrderItem.STATUS_IN_PROGRESS:
                baseOrderFormPresent = new TravellerWaitEndPresent(mOrderDetailView, orderItem);
                break;
            case OrderItem.STATUS_TRIP_FINISH:
                baseOrderFormPresent = new TravellerWaitCommentPresent(mOrderDetailView, orderItem);
                break;
            case OrderItem.STATUS_OVER:
                baseOrderFormPresent = new TravellerOverPresent(mOrderDetailView, orderItem);
                break;
            case OrderItem.STATUS_EXPIRED:
                baseOrderFormPresent = new TravellerUnvaliablePresent(mOrderDetailView, orderItem);
                break;
            case OrderItem.STATUS_REFUND:
                baseOrderFormPresent = new TravellerRefundPresent(mOrderDetailView, orderItem);
                break;
            default:
                baseOrderFormPresent = new TravellerOtherPresent(mOrderDetailView,orderItem);
                break;
        }
    }

    @Override
    public void render() {
        baseOrderFormPresent.render();
    }

    @Override
    public void clickBottomAction() {
        baseOrderFormPresent.clickBottomAction();
    }

    @Override
    public void clickBottomText() {
        baseOrderFormPresent.clickBottomText();
    }

    @Override
    public String getBottomActionText(OrderItem orderItem) {
        return baseOrderFormPresent.getBottomActionText(orderItem);
    }

    @Override
    public String getBottomText(OrderItem orderItem) {
        return baseOrderFormPresent.getBottomText(orderItem);
    }

    @Override
    public BottomButtonStyle getBottomButtonStyle(OrderItem orderItem) {
        return baseOrderFormPresent.getBottomButtonStyle(orderItem);
    }
}
